﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data ;
using System.Data.SqlClient;
using DTOLayer;
namespace DAOLayer
{
   public class LoginDAO:Dataprovider
    {
        public LoginDAO()
            : base()
        {
        }
        public LoginDTO getAccount(String uName, string uPass)
        {
            LoginDTO obj = null;
            try
            {
                string sql = "select user_names from tbl_Account where user_names ='" + uName + "' and user_pss ='" + uPass + "'";
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }
                SqlDataReader dr = new SqlCommand(sql, con).ExecuteReader();
                if (dr.Read())
                {
                    obj = new LoginDTO();
                    obj.User_names = dr["user_names"].ToString();
                    //obj.Parts_id = Int32.Parse(dr["parts_id"].ToString());
                    dr.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return obj;                
        }
    }
}
